<%--
  Created by IntelliJ IDEA.
  User: 娜娜
  Date: 2024/12/23
  Time: 21:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.Map" %>
<html>
<head>
    <title>报表管理</title>
</head>
<body>
<h2>报表管理</h2>
<h3>按时间段统计销售数量</h3>
<form action="<%=request.getContextPath()%>/report/countSalesByDay" method="get">
    <label for="startDate">开始日期：</label><input type="date" id="startDate" name="startDate"><br>
    <label for="endDate">结束日期：</label><input type="date" id="endDate" name="endDate"><br>
    <input type="submit" value="统计">
</form>
<table border="1">
    <tr>
        <th>日期</th>
        <th>销售数量</th>
    </tr>
    <%
        Map<String, Integer> salesCountMap = (Map<String, Integer>) request.getAttribute("salesCountMap");
        if (salesCountMap != null) {
            for (Map.Entry<String, Integer> entry : salesCountMap.entrySet()) {
    %>
    <tr>
        <td><%=entry.getKey()%></td>
        <td><%=entry.getValue()%></td>
    </tr>
    <%
            }
        }
    %>
</table>
<h3>按饮品分类统计销售金额</h3>
<form action="<%=request.getContextPath()%>/report/sumSalesByCategory" method="get">
    <input type="submit" value="统计">
</form>
<table border="1">
    <tr>
        <th>分类</th>
        <th>销售金额</th>
    </tr>
    <%
        Map<String, Double> salesAmountMap = (Map<String, Double>) request.getAttribute("salesAmountMap");
        if (salesAmountMap != null) {
            for (Map.Entry<String, Double> entry : salesAmountMap.entrySet()) {
    %>
    <tr>
        <td><%=entry.getKey()%></td>
        <td><%=entry.getValue()%></td>
    </tr>
    <%
            }
        }
    %>
</table>
</body>
</html>